<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>Spring MVC Application - Employee Manager</title>
<!-- CSS goes in the document HEAD or added to your external stylesheet -->

<style type="text/css">
table.formtable {
	font-family: verdana, arial, sans-serif;
	font-size: 11px;
	color: #333333;
	border-width: 1px;
	border-color: #999999;
	border-collapse: collapse;
	margin-left:auto; 
    margin-right:auto;
}

table.formtable th {
	background: #b5cfd2;
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}

table.formtable td {
	background: #dcddc0;
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}
</style>
<style type="text/css">
table.gridtable {
	font-family: verdana, arial, sans-serif;
	font-size: 11px;
	color: #333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
}

table.gridtable th {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #dedede;
}

table.gridtable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #ffffff;
}
</style>

<style>
h2 {
  color:#232323;
  font-style:normal;
  font-weight:300;
  letter-spacing:-1px;
  line-height:1.1em;
  margin:30px 0;
  text-align:center;
  font-size:42px;
}</style>

<style>
h3 {
  color:#232323;
  font-style:normal;
  font-weight:300;
  /* font-family:"Times New Roman", serif; */
  letter-spacing:-1px;
  line-height:1.1em;
  margin:30px 0;
  text-align:left;
  font-size:22px;
}</style>
</head>
<body>

	<h2>Employee Manager</h2>
	<h2 id="banner"><spring:message code="app.header" /></h2>
	<form:form method="post" action="add.html" commandName="employee">

		<table class="formtable">
			<tr>
				<td><form:label path="firstName">
						<spring:message code="label.firstname" />
					</form:label></td>
				<td><form:input path="firstName" /></td>
			</tr>
			<tr>
				<td><form:label path="lastName">
						<spring:message code="label.lastname" />
					</form:label></td>
				<td><form:input path="lastName" /></td>
			</tr>
			<tr>
				<td><form:label path="emailId">
						<spring:message code="label.email" />
					</form:label></td>
				<td><form:input path="emailId" /></td>
			</tr>
			<tr>
				<td><form:label path="phoneNumber">
						<spring:message code="label.telephone" />
					</form:label></td>
				<td><form:input path="phoneNumber" /></td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit"
					value="<spring:message code="label.addEmployee"/>" /></td>
			</tr>
		</table>
	</form:form>


	<h3>Employees</h3>
	<c:if test="${!empty employeeList}">
		<table class="gridtable">
			<tr>
				<th>Name</th>
				<th>Email</th>
				<th>Telephone</th>
				<th>&nbsp;</th>
			</tr>
			<c:forEach items="${employeeList}" var="employee">
				<tr>
					<td>${employee.lastName}, ${employee.firstName}</td>
					<td>${employee.emailId}</td>
					<td>${employee.phoneNumber}</td>
					<td><a href="delete/${employee.employeeId}">delete</a></td>
				</tr>
			</c:forEach>
		</table>
	</c:if>
	<c:if test="${empty employeeList}">
		<h4>No Employees</h4>
	</c:if>
</body>
</html>